package com.iplusai.myapplication.fragement;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;

import com.iplusai.myapplication.R;

/**
 *
 *
 * @date 2021/12/13.
 * email：
 * description：
 */
public class Fragement1 extends Fragment {
    private Button bt1;
    private Button bt2;
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.fragement1, container, false);;
        bt1 = view.findViewById(R.id.bt1);
        bt2 = view.findViewById(R.id.bt2);
        bt1.setOnClickListener(v -> {
           Navigation.findNavController(getView()).navigate(R.id.action_one_to_two);//这个id就是navigation里的action的id

        });
        bt2.setOnClickListener(v -> {
            Bundle bundle=new Bundle();
            bundle.putString("text","来自上级数据");
            Navigation.findNavController(getView()).navigate(R.id.action_one_to_three,bundle);//这个id就是navigation里的action的id

        });
        return view;
    }


}
